<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<title>用户中心</title>
	<script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
</head>
<body>

<script type="text/javascript">
 	var baseUrl = "http://127.0.0.1:8080/phoenix-apps-cms";
 
 	var hostName = window.location.hostname;
 	
 	function getOneShopRecommended(id){
 		$.ajax({
 			url:baseUrl+"/cmsShop/getOneShopRecommended/"+id,
 			type:'GET',
 			success:function(v){
 				$("#show").text("IdxShopRecommended [id=" + v.id + ", shopId=" + v.shopId
 							+ ", shopName=" + v.shopName + ", shopKeeperMotto="
 							+ v.shopKeeperMotto + ", picBanner=" + v.picBanner + ", picHref="
 							+ v.picHref + ", status=" + v.status + ", onlineTime=" + v.onlineTime
 							+ ", offlineTime=" + v.offlineTime + ", createTime=" + v.createTime
 							+ ", updateTime=" + v.updateTime + "]");
 			}
 		})
 	}
 	
	function showShopPersist(){
 		$.ajax({
 			url:baseUrl+"/cmsShop/getAllShopRecommendedByOrder",
 			type:'POST',
 			data:{pageSize:25,pageNo:1},
 			success:function(res){
 				$("#show").text("");
 				$.each(res.items,function(i,v){
 					$("#show").append("IdxShopRecommended [id=" + v.id + ", shopId=" + v.shopId
 							+ ", shopName=" + v.shopName + ", shopKeeperMotto="
 							+ v.shopKeeperMotto + ", picBanner=" + v.picBanner + ", picHref="
 							+ v.picHref + ", status=" + v.status + ", onlineTime=" + v.onlineTime
 							+ ", offlineTime=" + v.offlineTime + ", createTime=" + v.createTime
 							+ ", updateTime=" + v.updateTime + "]<br/>")
 				}) 
 			}
 		})
 	}
	function insertShopPersist(){
		var ont = new Date().getTime()+100*1000;
		var oft = new Date().getTime()+200*1000;
		$.ajax({
 			url:baseUrl+"/cmsShop/addOneShop",
 			type:'POST',
 			data:{status:2,picBanner:"xxxx",shopKeeperMotto:"XXXX",onlineTime:new Date(ont),offlineTime:new Date(oft)},
 			success:function(res){
 				$("#show").text("success");
 			},error:function(e1,e2){
 				$("#show").text(e2);
 				$("#show").append(e1.responseText);
 			}
 		})
 	}
	function updateShopPersist(shopId){
		$.ajax({
 			url:baseUrl+"/cmsShop/updateOneShopRecommended",
 			type:'POST',
 			data:{id:3, shopId:11, shopName:"怡然舒居", shopKeeperMotto:"文化就在生活中，民艺就是一种文化，在我们的生活中流传了几百上千年", picBanner:"/static/demoimg/pic3.jpg", picHref:"http://www.baidu.cn", status:0, onlineTime:new Date(new Date().getTime()+10*1000), offlineTime:new Date(new Date().getTime()+20*1000), createTime:new Date(1430186161), updateTime:new Date(1430186360)},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateShopStatusPersist(shopId,status){
		$.ajax({
 			url:baseUrl+"/cmsShop/updatePicShopRecommendedStatus",
 			type:'POST',
 			data:{shopId:shopId,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateShopListStatusPersist(shopIds,status){
		$.ajax({
 			url:baseUrl+"/cmsShop/updatePicShopRecommendedStatusList",
 			type:'POST',
 			data:{shopIds:shopIds,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	
 </script>
<button onclick="getOneShopRecommended(1)">show1测试</button><br>
<button onclick="showShopPersist()">show测试</button><br>
<button onclick="insertShopPersist()">insert测试</button><br>
<button onclick="updateShopPersist(2)">updateShop测试</button><br>
<button onclick="updateShopStatusPersist(2,3)">updateStatus测试</button><br>
<button onclick="updateShopListStatusPersist('6,5',1)">updateListStatus测试</button><br>
查询结果:<div id="show"></div>


<button onclick="alert(new Date()+'//'+new Date((new Date().getTime()+10*1000)))">1测试</button>
</body>
</html>